package com.sample.account.controller;

import com.sample.account.entity.AccountTblPO;
import com.sample.account.mapper.AccountTblMapper;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class AccountController {

    @Resource
    private AccountTblMapper accountTblMapper;

    @GlobalTransactional
    @GetMapping("/test")
    public void test(@RequestParam("userId") String userId){
        AccountTblPO po = new AccountTblPO();
        po.setUserId(userId);
        accountTblMapper.insert(po);
    }


}
